Brief Full Advanced Search Search Tips
|  |  | To access the contents, click the chapter and section titles. Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6! (Publisher: The Coriolis Group) Author(s): Peter G. Aitken ISBN: 1576102815 Publication Date: 08/01/98 Search this book:
Previous | Table of Contents | Next
As an example—using the previous business rules problem—you can use ActiveX and a three-tier client/server architecture to write an ActiveX component that contains the code to implement the rule stating “purchases over $500 must be approved by supervisor.” All database transactions involving orders are routed to this ActiveX component, which then does the following: 1. Checks to see whether the order is over $500. 2. If the order is over $500, checks to see whether the “approved by” field is filled in. 3. Verifies that the person named in the “approved by” field is at the supervisor level. 4. If the order is okay, passes the order to the data server for processing. Otherwise, returns the response “supervisor approval needed” to the client. Because this ActiveX “rules” component can run on any computer on the network, not just the client or server machines, processing can be spread out in the most efficient manner, to provide a quick response. Distributed Component Object Model (DCOM) is a protocol that permits applications to make remote, object-oriented procedure calls. (DCOM used to be called Network OLE.) In other words, a component that supports DCOM can communicate with other components by using a variety of network protocols, including the Hypertext Transport Protocol (HTTP), the protocol used on the Internet. With DCOM, the software components that make up a business application can be distributed across a local network, intranets, or the entire Internet. A business rule component, for example, could be maintained at a central location and accessed across the Internet by client/server applications at various remote offices. Updates and revisions to the business rules would be applied instantly to all relevant transactions throughout the enterprise. #### In-Process And Out-Of-Process Servers A server, or software component, can run either in-process or out-of-process. An in-process server runs in the same process space as the client application that is calling the server, while an out-of-process server runs in a different process space than the client application. An in-process server must be running on the same machine as the client, while an out-of-process server can be running on a remote computer. ActiveX Dynamic Link Libraries (DLLs) are in-process servers, while ActiveX EXEs are out-of-process servers. The code that a client uses to access a server is the same in either case, but communication between the client and the server is always faster for an in-process server, even compared to an out-of-process server on the same machine. To implement an in-process DLL server, however, the component has to be installed on every client machine. A trick around this limitation is to set up the DLL so that it is parented by an EXE. Because an in-process server runs in the same process space as the client application, if the in-process server crashes, the client application crashes with it. An out-of-process server is not crash-proof, but if it crashes, it doesn’t affect the client application. Table 24.1 presents some of the factors that you should consider when you select how to implement and deploy an ActiveX component. ### Tools For Client/Server Programming Microsoft provides a variety of tools to assist you in client/server development. Some of these tools are part of Visual Basic, while others are independent utilities. This section briefly describes the more important of these tools. Table 24.1 The pros and cons of ActiveX server types.
Component Type | Pros | Cons
--- | --- | ---
DLL (in process) | Quickest loading and execution | Local deployment required; no crash protection
EXE (local) | Good crash protection | Somewhat slower loading and execution
EXE (remote) | Remote execution, | Much slower execution; affected
| good crash protection | by network traffic
### Client Registration Utility For a client to make use of a server, the server must be registered on the client system. The registration process inserts information about the server into the Windows 95/98/NT registry. This registration can be accomplished in several ways: • EXE servers register themselves automatically when executed. • Using Visual Basic to compile a DLL or EXE server automatically registers the server. • The Package and Deployment Wizard can create a setup program for the server that installs and registers the component. Servers can also be registered from the command line by using the Client Registration Utility. To register a component using this utility, the server must be compiled with the Remote Server Files option turned on. This option is found on the Component tab of the Project Properties dialog box. When this option is enabled, Visual Basic creates a VBR file, which contains the registration information for the component. You then run CLIREG32.EXE from the command line, passing the name of the VBR file as its parameter. This utility provides options for remote registration, user authentication, and so on.
Previous | Table of Contents | Next

| Products | Contact Us | About Us | Privacy | Ad Info |